﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Linq;
using System.Linq.Expressions;

namespace wuyeOTO.Admin.{subFolder}
{
    public partial class [tblName]List : wuyeOTO.pageBase
    {
        public Bll.[tblName]Bll bll = new Bll.[tblName]Bll();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitPage();
                LoadData();
            }
        }

        protected void btnQuery_Click(object sender, EventArgs e)
        {
            LoadData();
        }


        /// <summary>
        /// 第一次加载页面时候执行
        /// </summary>
        protected override void InitPage()
        {
        }


        /// <summary>
        /// 加载数据
        /// </summary>
        protected override void LoadData()
        {
            #region 分页控件绑定

            //翻页参数
            if (inputPageByButton.Value == "0")
            {
                int.TryParse(inputGo2page.Value, out currentPage);
                inputPageByButton.Value = "1";
            }

            //输入参数
            //dicCondition.Add("name", txtQryName.Text);
            //排序参数
            //dicCondition.Add("orderby", " m.id ");

            var dtable = bll.GetPageDataTable(dicCondition, currentPage, pageSize, out totalRecord);
            thisPagelRecord = dtable.Rows.Count;
            rpt[tblName]List.DataSource = dtable;
            rpt[tblName]List.DataBind();

            string js2run = thisPagelRecord == 0 ? formatError("对不起，没有符合条件的数据。") : string.Format("<script>pagerInit({0},{1},{2});</script>", currentPage, totalRecord, pageSize);
            ScriptManager.RegisterStartupScript(UpdatePanel[tblName]List, this.GetType(), "bzz", js2run, false);
            #endregion

        }
    }
}







